﻿@using Eksponent.CropUp
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Lu.Blog.Models.GridViewModel>
@if (Model.Items.Any())
{
    <!-- Filter container -->
    <div id="filter-container" class="cf">
        @{
            var items = new List<dynamic>();
            foreach (var categorySet in Model.Items)
            {
                items.AddRange(from i in categorySet.Value select new {Category = categorySet.Key, Item = i});
            }
        }
        @foreach (var item in items)
        {
            <figure class="@(item.Category.Replace(" ", String.Empty).ToLower())">
                <a href="@(item.Item.Page.NiceUrl)" class="thumb">
                    @if (!String.IsNullOrEmpty(item.Item.SummaryImageUrl))
                    {
                        <img src="@(CropUp.GetUrl(item.Item.SummaryImageUrl, new ImageSizeArguments{Width = 300}))" alt=""/>
                    }
                </a>
                <figcaption>
                    <a href="@(item.Item.Page.NiceUrl)"><h3 class="heading">@(item.Item.SummaryTitle)</h3></a>
                    @Html.Raw(item.Item.SummaryBody)
                </figcaption>
            </figure>
        }
    </div>
    <!-- ENDS Filter container -->
}